package com.ice.work.moment.crawler.service;

import com.alicp.jetcache.anno.Cached;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.honeybee.cloud.framework.base.exception.business.BaseBizException;
import com.honeybee.cloud.framework.common.page.Page;
import com.ice.work.moment.facade.crawler.dto.ShareDTO;
import com.ice.work.moment.facade.crawler.model.Share;

import java.util.Collection;
import java.util.List;

/**
 * @Description 股票信息
 * @Author DELL
 * @Create 2019-05-05
 * @Since 1.0.0
 */
@SuppressWarnings("unused")
public interface IShareService {
    String KEY = "SHARE_";

    /**
     * 保存信息
     *
     * @param shares
     * @return
     * @throws BaseBizException
     */
    Boolean saveOrUpdate(Collection<Share> shares) throws BaseBizException;

    /**
     * 通过stockCode查询
     *
     * @param shareCode
     * @return
     * @throws BaseBizException
     */
    @Cached(name = KEY, key = "#shareCode")
    ShareDTO findByShareCode(String shareCode) throws BaseBizException;

    /**
     * 通过shareCodes查询
     *
     * @param shareCodes
     * @return
     * @throws BaseBizException
     */
    List<ShareDTO> findByShareCodes(Collection<String> shareCodes) throws BaseBizException;

    /**
     * 分页查询
     *
     * @param page
     * @return
     * @throws BaseBizException
     */
    Page<ShareDTO> page(IPage<Share> page) throws BaseBizException;

    /**
     * 查询详情
     *
     * @param id
     * @return
     * @throws BaseBizException
     */
    ShareDTO findById(Long id) throws BaseBizException;
}
